package cn.achao.csr.system.controller;

import cn.achao.csr.api.model.dto.RolePageDTO;
import cn.achao.csr.base.resp.R;
import cn.achao.csr.log.annotation.CsrLog;
import cn.achao.csr.security.annotation.RequiresPermissions;
import cn.achao.csr.system.service.SysRoleService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: achao
 **/
@Slf4j
@RestController
@RequestMapping("/role")
@RequiredArgsConstructor
public class SysRoleController {

    private final SysRoleService roleService;

    @RequiresPermissions("system:role:list")
    @GetMapping("/page")
    @CsrLog(title = "角色管理列表")
    public R<?> page(@Validated RolePageDTO req) {
        return R.ok(roleService.selectRoleList(req));
    }
}
